<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>混入</title>
  <script src="../vue.js"></script>
</head>
<body>
  <div id="root">
    <comp1></comp1>
    <comp2></comp2>
    <input type="text" v-abc>
  </div>
  <script type="module">
    Vue.config.productionTip = false

    import mixin from './minix.js'
    import './v-focus.js'

    const Comp1 = {
      template: `
        <div @click="handleClick">component 1 {{title}} {{message}} {{title2}}</div>
      `,
      mixins: [mixin],
      data() {
        return {
          message: 'hello world',
          title: 'haha'
        }
      },
      methods: {
        handleClick() {
          console.log('in comp1')
        }
      },
      computed: {
        title2() {
          return this.title + '!!!'
        }
      }
    }
    const Comp2 = {
      template: `
        <div>component 2 {{title}} {{title2}}</div>
      `,
      mixins: [mixin],
      mounted() {
        console.log('comp2 mounted.')
      },
    }
    var vm = new Vue({
      el: '#root',
      components: {
        Comp1,
        Comp2
      }
    })
  </script>
</body>
</html>